www.gusucode.com > 基于Matlab的MIMO通信系统仿真 含报告;司中威;了解移动通信 > 基于Matlab的MIMO通信系统仿真 含报告;司中威;了解移动通信关键技术,了解数字通信系统仿真流程,实现基本的信道编译码、调制解调等通信模块。(好评如潮,课设拿满) 学习并实现MIMO空时处理技术 学习性能分析的思路和方法/mimo/matlab for mimo 2x2/Test_050426_1.m

    clear all; close all

data_input_I=read_float32_hex('Input_I.dat');
data_input_Q=read_float32_hex('Input_Q.dat');

data_input_I_cut = data_input_I(14:end);    %Cut the 13 first elements in data_input_I since they are zero
data_input_Q_cut = data_input_Q(14:end);    %Cut the 13 first elements in data_input_Q since they are zero

Fs = 96000; % Sampling frequency (Hz) 
Fc = 10000; % Carrier frequency (Hz)
L = 10; % Upsampling factor

% Upsample
data_input_I_cut_up = upsample(data_input_I_cut,L);
data_input_Q_cut_up = upsample(data_input_Q_cut,L);

% Pulse Shape
roll_off_factor = .22;
half_filter_len = 7; % Half-Length of the RRC
pulse_shape = root_raised_cosine(L, roll_off_factor, half_filter_len);

% Pulse-shaping
%out_I = conv(data_input_I_up, pulse_shape);
%out_Q = conv(data_input_Q_up, pulse_shape);
output_matlab_I = filter(pulse_shape, 1, data_input_I_cut_up);
output_matlab_Q = filter(pulse_shape, 1, data_input_Q_cut_up);

output_DSP_I=read_float32_hex('Output_I.dat');
output_DSP_Q=read_float32_hex('Output_Q.dat');

write_float32_hex('Output_matlab_I.dat',output_matlab_I);
write_float32_hex('Output_matlab_Q.dat',output_matlab_Q);

%Upconversion
output_matlab_upconv = upconv(output_matlab_I,output_matlab_Q,Fc,Fs,0);

output_DSP_upconv = read_int16_hex('Output_upconv.dat');
output_DSP_upconv = output_DSP_upconv(1:5840);
output_DSP_upconv = output_DSP_upconv(1:2:end);

error = sum((output_matlab_upconv-output_DSP_upconv).^2)/length(output_DSP_upconv)

% Compare e.g. graphically
figure(1)
plot(output_matlab_I,'b')
hold on
plot(output_DSP_I,'g')
legend('Matlab result of I-part','DSP result I-part');
figure(2)
plot(output_matlab_Q,'b')
hold on
plot(output_DSP_Q,'g')
legend('Matlab result Q-part','DSP result Q-part');
figure(3)
plot(output_matlab_upconv,'b')
hold on
plot(output_DSP_upconv,'g')
legend('Matlab result upconv','DSP result upconv');